#存放app相关的操作，重启，关闭，打开等
from appium import webdriver

from test_appium.test_wechat.PO.PO_page.MainPage import MainPage


class APP():


    def start(self):
        #启动
        caps = {
            "platformName": "android",
            "deviceName": "127.0.0.1:7555",
            "appPackage": "com.tencent.wework",
            "appActivity": ".launch.WwMainActivity",
            "noReset": True,
            "dontStopAppOnReset": True,
            "skipDeviceInitialization": True,
            # "unicodeKeyBoard":True,
            # "resetKeyBoard":True
            # #首次启动时，不停止APP
        }
        self.driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)

        self.driver.implicitly_wait(5)

        return self
        #return self留在当前页面

    def restart(self):
        #重启
        pass
    def stop(self):
        #停止
        self.driver.quit()
    def goto_main(self):
        #回到主页
        return MainPage(self.driver)